package com.hq.fxh.No3_TuiGuang.MyMoBan;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * @author 小谢
 * @ClassName AdStoreAdapter
 * @Description :
 * @Created 2016/11/23 0023
 */
public class AdStoreAdapter extends PagerAdapter {

    private List<View> viewContainter;

    public AdStoreAdapter(List<View> viewContainter) {
        this.viewContainter = viewContainter;
    }
    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(viewContainter.get(position));
        return viewContainter.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(viewContainter.get(position));
    }

    @Override
    public int getCount() {
        return viewContainter.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

}
